<!--
* @description:付款管理
* @fileName: PaymentManagement
* @author:石锦涛
* @date:2022-01-12
* @后台人员:石锦涛
-->
<template>
  <div>
    <!-- 付款管理 -->
    <div>
      <el-row :span="1">
        <el-col :span="1.5">标题:</el-col>
        <el-col :span="4"><input v-model="tilet" /></el-col>
        <el-col :span="1.5">申请日期:</el-col>
        <el-col :span="4"><input type="Date" v-model="times" /></el-col>
        <el-col :span="1.5">审批状态:</el-col>
        <el-col :span="4">
          <el-select v-model="state" placeholder="请选择">
            <el-option
              v-for="item in optionsc"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col>
      </el-row>
      <br />
      <el-row :span="1">
        <el-col :span="1.5">审批人:</el-col>
        <el-col :span="4"><input v-model="name" /></el-col>
        <el-col :span="1"><button @click="showNewow()">查询</button></el-col>
        <el-col :span="1"><button @click="chongzhi()">重置</button></el-col>
      </el-row>
      <br />
      <el-row :span="1">
        <el-col :span="1"
          ><el-button @click="addpust()">新增</el-button></el-col
        >
        <el-col :span="3"
          ><el-button @click="deleteMores()">删除</el-button></el-col
        >
        <el-col :span="1"
          ><el-button @click="zhi()">支付</el-button></el-col
        >
      </el-row>
    </div>
    <!-- 应付费用管理 -->
    <el-table
      ref="multipleTable"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column prop="Headline" label="标题" width="130">
      </el-table-column>
      <el-table-column prop="UserDescribe" label="用途描述" width="100">
      </el-table-column>
      <el-table-column prop="PaymentAmount" label="付款金额" width="100">
      </el-table-column>
      <el-table-column prop="ClearingForm" label="付款方式" width="100">
      </el-table-column>
      <el-table-column prop="ObjectOfPayment" label="支付对象" width="100">
      </el-table-column>
      <el-table-column prop="OpeningBank" label="开户行" width="100">
      </el-table-column>
      <el-table-column prop="BankAccount" label="银行账号" width="130">
      </el-table-column>
      <el-table-column prop="Proposer" label="申请人" width="80">
      </el-table-column>
      <el-table-column prop="DateOfPayments" label="付款日期" width="100">
      </el-table-column>
      <el-table-column prop="Remarkm" label="备注" width="120">
      </el-table-column>
      <el-table-column prop="EstablishTimezs" label="创建日期" width="100">
      </el-table-column>
      <el-table-column prop="ApprovalStatusj" label="审批状态" width="80">
        <template slot-scope="scope">
          {{scope.row.ApprovalStatusj?"审核通过":"待审核"}}
        </template>
      </el-table-column>
      <el-table-column prop="Approverg" label="审批人" width="80">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <a href="#" @click="Bianji(scope.row)">编辑</a> &nbsp;
          <a href="#" @click="deletesc(scope.row)">删除</a>&nbsp;
          <a href="#" @click="Looks(scope.row)">查看</a>&nbsp;
          <a href="#" @click="Looks(scope.row)">提交审核</a>&nbsp;
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageindex"
      :page-sizes="[1, 3, 5, 7]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalCount"
    >
    </el-pagination>
    <!--查看信息-->
    <div>
      <el-dialog title="查看信息" :visible.sync="dialogFormVisible">
        <div slot="footer" class="dialog-footer">
          <el-row :span="1">
            <el-col :span="5">标题:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.Headline"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">付款金额:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.PaymentAmount"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">结算方式:</el-col>
            <el-col :span="10">
              <el-radio-group v-model="jieshu.ClearingForm">
                <el-radio label="微信支付">微信支付 </el-radio>
                <el-radio label="支付宝支付">支付宝支付</el-radio>
                <el-radio label="银联支付">银联支付 </el-radio>
                <el-radio label="企业转账">企业转账 </el-radio>
                <el-radio label="线下支付">线下支付 </el-radio>
                <el-radio label="其他">其他 </el-radio>
              </el-radio-group>
            </el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">支付对象:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.ObjectOfPayment"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">开户行:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.OpeningBank"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">银行账户:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.BankAccount"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">付款日期:</el-col>
            <el-col :span="10"
              ><el-input type="Date" v-model="jieshu.DateOfPayments"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">用途描述:</el-col>
            <el-col :span="10"
              ><el-input
                type="textarea"
                v-model="jieshu.UserDescribe"
              ></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">备注:</el-col>
            <el-col :span="10"
              ><el-input type="textarea" v-model="jieshu.Remarkm"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-button @click="quxiao()">关 闭</el-button>
        </div>
      </el-dialog>
    </div>
    <!--编辑-->
    <div>
      <el-dialog title="修改信息" :visible.sync="dialogFormVisible1">
        <div slot="footer" class="dialog-footer">
          <el-row :span="1">
            <el-col :span="5">标题:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.Headline"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">付款金额:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.PaymentAmount"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">结算方式:</el-col>
            <el-col :span="10">
              <el-radio-group v-model="jieshu.ClearingForm">
                <el-radio label="微信支付">微信支付 </el-radio>
                <el-radio label="支付宝支付">支付宝支付</el-radio>
                <el-radio label="银联支付">银联支付 </el-radio>
                <el-radio label="企业转账">企业转账 </el-radio>
                <el-radio label="线下支付">线下支付 </el-radio>
                <el-radio label="其他">其他 </el-radio>
              </el-radio-group>
            </el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">支付对象:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.ObjectOfPayment"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">开户行:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.OpeningBank"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">银行账户:</el-col>
            <el-col :span="10"
              ><el-input v-model="jieshu.BankAccount"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">付款日期:</el-col>
            <el-col :span="10"
              ><el-input type="Date" v-model="jieshu.DateOfPayments"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">用途描述:</el-col>
            <el-col :span="10"
              ><el-input
                type="textarea"
                v-model="jieshu.UserDescribe"
              ></el-input
            ></el-col>
          </el-row>
          <br />
          <el-row :span="1">
            <el-col :span="5">备注:</el-col>
            <el-col :span="10"
              ><el-input type="textarea" v-model="jieshu.Remarkm"></el-input
            ></el-col>
          </el-row>
          <br />
          <el-button @click="quxiao()">取 消</el-button>
          <el-button type="primary" @click="updateshuju">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      multipleSelection: [],
      tableData: [],
      tilet: "",
      times: "",
      state: "",
      name: "",
      totalCount: 0,
      pageindex: 1,
      pagesize: 5,
      dialogFormVisible: false,
      dialogFormVisible1: false,
      jieshu: {
        Id: "",
        ApplyNumber: "",
        Headline: "",
        PaymentAmount: "",
        ClearingForm: "",
        ObjectOfPayment: "",
        OpeningBank: "",
        BankAccount: "",
        DateOfPayment: "",
        UserDescribe: "",
        Remarkm: "",
        Accessory: "",
        Proposer: "",
        EstablishTimez: "",
        ApprovalStatusj: "",
        Approverg: "",
        IsDelete: "",
      },
      ids: [],
      optionsc: [
        {
          value: "0",
          label: "待审核",
        },
        {
          value: "1",
          label: "审核通过",
        },
        {
          value: "2",
          label: "审核失败",
        },
      ],
      value: "",
    };
  },
  methods: {
    //支付
     zhi() {
      this.$router.push("/ZhiFu");
    },
    //多选
    handleSelectionChange(val) {
      this.ids = [];
      this.multipleSelection = val;
      for (let index = 0; index < val.length; index++) {
        this.ids.push(val[index].GId);
      }
    },
    //分页
    handleSizeChange(val) {
      //console.log(`每页 ${val} 条`);
      this.pagesize = val;
      this.showNewow();
    },
    handleCurrentChange(val) {
      //console.log(`当前页: ${val}`);
      this.pageindex = val;
      this.showNewow();
    },
    //显示数据
    showNewow() {
      this.$axios
        .get(
          "https://localhost:44399/api/app/payment-app/payment?tilet=" +
            this.tilet +
            "&times=" +
            this.times +
            "&state=" +
            this.state +
            "&name=" +
            this.name +
            "&pageindex=" +
            this.pageindex +
            "&pagesize=" +
            this.pagesize +
            ""
        )
        .then((res) => {
          this.tableData = res.data.PageData;
          this.totalCount = res.data.PageTotal;
        });
    },
    //重置
    chongzhi() {
      (this.name = ""),
        (this.state = ""),
        (this.times = ""),
        (this.tilet = ""),
        this.showNewow();
    },
    //删除
    deletesc(row) {
      if (confirm("是否确定删除")) {
        this.$axios
          .delete(
            "https://localhost:44399/api/app/payment-app/payment/" +
              row.GId +
              ""
          )
          .then((res) => {
            if (res.data.Code > 0) {
              alert("删除成功");
              this.showNewow();
            } else {
              alert("删除失败");
              this.showNewow();
            }
          });
      }
    },
    //显示查看
    Looks(row) {
      this.jieshu = row;
      this.dialogFormVisible = true;
    },
    //编辑
    Bianji(row) {
      this.jieshu = row;
      this.dialogFormVisible1 = true;
    },
    //编辑数据保存
    updateshuju() {
      this.$axios
        .put("https://localhost:44399/api/app/payment-app/payment", this.jieshu)
        .then((res) => {
          if (res.data.Code > 0) {
            alert("修改成功");
            this.dialogFormVisible1 = false;
            this.showNewow();
          } else {
            alert("修改失败");
            this.dialogFormVisible1 = false;
          }
        });
    },
    //关闭时刷新
    quxiao() {
      this.dialogFormVisible = false;
      this.dialogFormVisible1 = false;
      this.showNewow();
    },
    //添加数据
    addpust() {
      this.$router.push("/PaymentRequest");
    },
    //批量删除
    deleteMores() {
      if (this.ids.length === 0) {
        alert("请选择数据");
        return;
      }
      if (confirm("是否确定删除")) {
        this.$axios
          .delete(
            "https://localhost:44399/api/app/payment-app/payment-ment/" +
              this.ids.toString()
          )
          .then((res) => {
            if (res.data.Code > 0) {
              alert("删除成功");
              this.showNewow();
            } else {
              alert("删除失败");
            }
          });
      }
    },
  },
  created() {
    this.showNewow();
  },
};
</script>

<style>
</style>